package com.hulushuju.core.net.http;

import com.hulushuju.core.net.http.callback.HttpCallback;

import java.io.IOException;

/**
 * @Author: Hanjiafeng
 * @Date: 2019-05-29
 * @Desc: 不知道怎么形容, 等我想想
 */
public interface HttpEngine {
    /**
     * 同步执行请求
     *
     * @param httpRequest 请求对象
     * @return 响应对象
     * @throws IOException 执行异常
     */
    HttpResponse execute(HttpRequest httpRequest) throws IOException;

    /**
     * 异步执行请求
     *
     * @param httpRequest  请求对象
     * @param httpCallback 回调接口
     * @throws IOException 执行异常
     */
    void asyncExecute(HttpRequest httpRequest, HttpCallback httpCallback) throws IOException;

    /**
     * 关闭请求对象
     */
    void close();
}
